|
DX11 DISPATCH COMPUTE SHADER
Dispatches the specified compute shader to be run on as many thread groups as are specified.
The [numthreads(x, y, z)] attribute specified in your shader means that this many threads will be executed per thread group.
Thread groups, as well as the numthreads attribute, use 3 dimensions (2 on DX10 hardware, in which case the z component should be set to 1) instead of a set number.
The reason for this is that it is considered helpful to envision threads and thread groups in 3D/2D space to aid in breaking down algorithms for paralellization.
You can access the thread and thread group id's from your shader in order to delegate a certain subset of work for the compute shader to work on, such that for example
each thread processes 4x4 pixels and a thread group contains 8x8 such thread and thus processes 32x32 pixels per group. Completely different data than pixels can of course be processed by compute shaders as well.
DX11 DISPATCH COMPUTE SHADER shader, threadGroupCountX, threadGroupCountY, [threadGroupCountZ]
shader Dword The compute shader to dispatch (execute).
threadGroupCountX Word The number of thread groups to execute the compute shader on in the X-dimension.
threadGroupCountY Word The number of thread groups to execute the compute shader on in the Y-dimension.
[Optional] threadGroupCountZ Word The number of thread groups to execute the compute shader on in the Z-dimension. Must be set to 1 in DX10 mode (shader model 4). Defaults to 1 if omitted.
This function does not return a value.
DIRECTCOMPUTE Functions Menu
DX11 Function Categories
|